package com.zmn.mcc.business.impl.role;

import com.alibaba.fastjson.JSONObject;
import com.zmn.common.dto2.ResponseDTO;
import com.zmn.common.utils.string.StringUtil;
import com.zmn.mcc.business.interfaces.role.RoleSysBService;
import com.zmn.mcc.model.entity.role.McRoleSys;
import com.zmn.mcc.services.interfaces.role.RoleService;
import com.zmn.mcc.services.interfaces.role.RoleSysService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author heguanghua
 * @since 2020/04/14 22:59
 */
@Service
public class RoleSysBServiceImpl implements RoleSysBService {
    protected Logger logger = LoggerFactory.getLogger(RoleSysBServiceImpl.class);

    @Resource
    private RoleSysService roleSysService;


    // region 修改角色拥有的系统

    /**
     * 修改角色拥有的系统
     * @param roleSyses
     * @return
     */
    @Override
    public ResponseDTO modifyRoleSys(List<McRoleSys> roleSyses) {

        try {

            roleSysService.insertByBatch(roleSyses);

            return ResponseDTO.success(null, "修改角色拥有的系统成功");

        } catch (Exception ex) {
            logger.error(String.format("[ZMN]修改角色拥有的系统失败,roleSyses:[%s],ex:[%s]", JSONObject.toJSONString(roleSyses), ex.getMessage()));
            return ResponseDTO.fail("修改角色拥有的系统失败");
        }

    }
    // endregion
}
